package com.x.erp.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.GateCarDao;
import com.x.erp.manage.GateCarManage;
import com.x.erp.model.GateCar;
import com.x.erp.rpc.GateCarRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;

/**
 * 道闸出入车辆信息服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.GateCarRpcService", timeout = 60000)
public class GateCarService extends BaseService implements GateCarRpcService {

	@Autowired
	private GateCarDao gateCarDao;// 道闸出入车辆信息信息DAO
	
	@Autowired
	private GateCarManage gateCarManage;// 道闸出入车辆信息信息Manage

	/**
	 * 查询道闸出入车辆信息列表
	 * 
	 * @param gateCar
	 * @return
	 */
	@Override
	public List<GateCar> selectGateCarList(GateCar gateCar) {
		try {
			return gateCarDao.selectGateCarList(gateCar);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 查询道闸出入车辆信息数量
	 * 
	 * @param gateCar
	 * @return
	 */
	@Override
	public int selectGateCarNum(GateCar gateCar) {
		try {
			return gateCarDao.selectGateCarNum(gateCar);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 新增道闸出入车辆信息信息
	 * 
	 * @param gateCar
	 * @return
	 */
	@Override
	public GateCar insertGateCar(GateCar gateCar) {
		try {
			return gateCarManage.insertGateCar(gateCar);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 修改道闸出入车辆信息信息
	 * 
	 * @param gateCar
	 * @return
	 */
	@Override
	public int updateGateCar(GateCar gateCar) {
		try {
			return this.update(gateCar);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
